# 对波长进行标定
import os

import numpy as np
from scipy.signal import find_peaks
import json

class SpectrumCalibration:
    def __init__(self):# 传入x[]全是1，2，3的count，y[]全是累加的面积
        self.y_rec_intensity = []
        self.y = []#需要输出的y轴，光强

    #需要输出的y轴
    def sub_intensity(self):
        # self.y.append(self.y_rec_intensity[0])
        # for i in range(1,len(self.y_rec_intensity)):
        #     self.y.append(self.y_rec_intensity[i] - self.y_rec_intensity[i - 1])
        #未作处理的y
        for i in range(len(self.y_rec_intensity)):
            if(self.y_rec_intensity[i]<50000):
                if(len(self.y)!=0):
                    self.y.append(self.y[i-1])
                else:
                    self.y.append(self.y_rec_intensity[i])
            else:
                self.y.append(self.y_rec_intensity[i])


    #传入数据,First
    def input_data(self,y):
        self.y_rec_intensity = y

    #clear数据,Finish
    def clear_data(self):
        self.y = []
        self.y_rec_intensity = []

    def deal_data(self):
        self.sub_intensity()#先做减法,y轴数据完备








